package umg.gui;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;

import javax.swing.GrayFilter;
import javax.swing.JTextArea;

public class JTextAreaWithBackground extends JTextArea
{
	private static final long serialVersionUID = 1L;
	Image grayImage;

	public JTextAreaWithBackground(String background)
	{
		super();
		URL bgURL = getClass().getResource(background);
		grayImage = GrayFilter.createDisabledImage(Toolkit.getDefaultToolkit().getImage(bgURL));
		this.setOpaque(false);
	}

	public JTextAreaWithBackground()
	{

	}

	public void paintComponent(Graphics g)
	{
		// g.drawImage(image, 0, 0, 373, 300, this);
		g.drawImage(grayImage, this.getVisibleRect().x, this.getVisibleRect().y, 393, 428, this);
		super.paintComponent(g);
	}

}
